import {get, post} from '../utils/http';

export interface IBook {
  id: number;
  bookname: string;
  author: string;
  publisher: string;
}

// 请求参数接口
export interface IBookReq {
  bookname: string;
  author: string;
  publisher: string;
}

// 获取图书列表
export const getBooksAPI = () => {
  return get<IBook[]>('/books');
};

// 新增图书
export const addBookAPI = (data: IBookReq) => {
  return post<IBook[], IBookReq>('/books', data);
};
